package com.xiaoluyy.demo.common.util;

/**
 * Created by Administrator on 2015/10/15.
 */
public class MimeUtil {

    /**
     * 获取图片的mime类型
     * @param ext
     * @return
     */
    public static String getImgMime(String ext) {
        String mime = "";
        switch (ext.toLowerCase()) {
            case ".jpe":
            case ".jpeg":
            case ".jpg":
                mime = "image/jpeg";
                break;
            case ".png":
                mime = "image/png";
                break;
            case ".gif":
                mime = "image/gif";
                break;
            case ".bmp":
                mime = "image/bmp";
                break;
            case ".ico":
                mime = "image/x-icon";
                break;
            default:
                break;
        }
        return mime;
    }

}
